package com.museum.controller.impl;

import com.alibaba.fastjson.JSONObject;
import com.museum.base.BaseApiService;
import com.museum.base.BaseResponse;
import com.museum.controller.api.AreaAPI;
import com.museum.entity.DTO.area.AreaDTO;
import com.museum.entity.DTO.area.addArea;
import com.museum.service.api.AreaServiceAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author LB
 * @version 1.0
 * @date 2020/12/9 19:41
 */
@RestController
@RequestMapping("/area")
public class AreaController extends BaseApiService<JSONObject> implements AreaAPI {
   @Autowired
   private AreaServiceAPI areaServiceAPI;
    @Override
    public BaseResponse<JSONObject> addArea(addArea areaDTO) {
        return areaServiceAPI.addArea(areaDTO);
    }

    @Override
    public BaseResponse<JSONObject> deleteArea(Integer number) {
        return areaServiceAPI.deleteAreaByNumber(number);
    }

    @Override
    public BaseResponse<JSONObject> updateArea(AreaDTO updateDept) {
        return null;
    }

    @Override
    public BaseResponse<JSONObject> getAllArea(HttpServletRequest request) {
       return  areaServiceAPI.getAllAreas(request);
    }
}
